home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
ARGONET
/
PD
/
UTILITIES
/
BOGOMIPS.SPK
/
!Desk_Bogo
/
c
/
bogomips
next >
Wrap
Text File
|
1996-04-28
|
1KB
|
48 lines
/*
* Standalone BogoMips program
*
* Based on code Linux kernel code in init/main.c and
* include/linux/delay.h
*
* For more information on interpreting the results, see the BogoMIPS
* Mini-HOWTO document.
*
* version: 1.3
* author: Jeff Tranter (Jeff_Tranter@Mitel.COM)
*
* modified version:
* author: Julyan Bristow
* purpose: call as a function from a desktop application for Acorn
* RISC OS machines
*/
#include <stdio.h>
#include <time.h>
/* use the portable version of bogomips */
static void delay(long loops)
{
long i;
for (i = loops; i >= 0 ; i--);
}
int bogo_mips_main(unsigned long *whole,unsigned long *fraction)
{
unsigned long loops_per_sec = 1;
unsigned long ticks;
while ((loops_per_sec <<= 1)) {
ticks = clock();
delay(loops_per_sec);
ticks = clock() - ticks;
if (ticks >= CLOCKS_PER_SEC) {
loops_per_sec = (loops_per_sec / ticks) * CLOCKS_PER_SEC;
*whole = loops_per_sec/500000;
*fraction = (loops_per_sec/5000) % 100;
return 1;
}
}
return 0;
}